//package com.tiancheng.trade.order.aop;
//
//import com.tiancheng.trade.commom.core.exception.BusinessException;
//import com.tiancheng.trade.commom.core.exception.error.CommonErrorInfoEnum;
//import com.tiancheng.trade.order.service.OrderParallelService;
//import com.tiancheng.trade.order.util.OrderParallelUtil;
//import jakarta.annotation.Resource;
//import lombok.extern.slf4j.Slf4j;
//import org.aspectj.lang.ProceedingJoinPoint;
//import org.aspectj.lang.annotation.Around;
//import org.aspectj.lang.annotation.Pointcut;
//
///**
// * 兼容老订单中心的核销流程
// *
// * @author kellen
// * @date 2024/9/3
// */
///*@Component
//@Aspect*/
//@Slf4j
//public class SubOrderServiceAspect {
//
//    @Resource
//    private OrderParallelService orderParallelService;
//
//    @Pointcut("execution(public * com.cloud.trade.order.service.impl.SubOrderServiceImpl.statusFlow(..))")
//    public void statusFlowPoint() {}
//
//    /**
//     * 子订单状态流转
//     * @param point
//     * @return
//     * @throws BusinessException
//     */
//    @Around("statusFlowPoint()")
//    public void statusFlowAround(ProceedingJoinPoint point) throws BusinessException {
//        String orderId = (String) point.getArgs()[0];
//        // 兼容老订单系统核销
//        if (OrderParallelUtil.isOrderSubSystem(orderId)) {
//            String[] subOrderId = (String[]) point.getArgs()[1];
//            String bizStatus = (String) point.getArgs()[2];
//            orderParallelService.subOrderStatusFlow(orderId, subOrderId, bizStatus);
//            return;
//        }
//
//        try {
//            point.proceed();
//        } catch (BusinessException e) {
//            throw e;
//        } catch (Throwable e) {
//            log.error(e.getMessage(), e);
//            throw new BusinessException(CommonErrorInfoEnum.SERVER_BUSY, null, e.getMessage(), e);
//        }
//    }
//}
